package com.yc.web.controller;

import com.yc.model.User;
import com.yc.service.IUserService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private IUserService userService;


   // Logger logger = Logger.getLogger(IUserService.class);



    @RequestMapping("/find")
    @ResponseBody
    public User find(String username) {
        System.out.println(username + "----");
        return userService.find(username);
    }

    @RequestMapping("/save")
    @ResponseBody
    public int save(String username, String password) {
        System.out.println(username + "----" + password);
        //logger.info("aaaaaaaaaaaaaaaaaaaaa:"+username+"password:"+password);

        return userService.save(username, password);
    }
}
